//
//  Extension+UILabel.swift
//  WeiBlog
//
//  Created by apple on 15/10/21.
//  Copyright © 2015年 xiang. All rights reserved.
//

import UIKit

extension UILabel {
    
    ///  文本,字号,字体颜色,距离屏幕的距离
    convenience init(text:String,fontSize:CGFloat = 17,color:UIColor = UIColor.darkGrayColor(),screenSet:CGFloat = 0){
        self.init()
        
        self.text = text
        font = UIFont.systemFontOfSize(fontSize)
        textColor = color
        numberOfLines = 0
        
        if screenSet == 0{
            textAlignment = NSTextAlignment.Center
        }else{
            preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * screenSet
            textAlignment = NSTextAlignment.Left
        }
        
        sizeToFit()
    }
    
}
